<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>html</title>
<script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<script src="js/components/aes-min.js"></script>

</head>
<body>


<input onclick="encode();" value="加密" type="button">
<input onclick="decode();" value="解密" type="button">
密钥:<input id="Passphrase" value="Secret Passphrase">
<br>
<textarea id="s1" style="width: 400px;height: 400px;"></textarea>
<textarea id="e1" style="width: 400px;height: 400px;"></textarea>
 
 
 
 <script type="text/javascript">
 
var Passphrase = document.getElementById("Passphrase");
 
   function encode(){
	   var code = document.getElementById("s1").value;
	   
	   document.getElementById("e1").value = CryptoJS.AES.encrypt(code, Passphrase.value);
  
   }
   
   function decode(){
	   var code = document.getElementById("e1").value;
	   
	   document.getElementById("s1").value = CryptoJS.AES.decrypt(code, Passphrase.value);
   }
 
 </script>
</body>
</html>